belonarfandomcom_ar-20200215-history
وحدة:لغات
local p = {} local lang_table = require('Module:لغات/بيانات') local lang_name = {} local lang_name_with_al = {} local lang_codes = {} local scripts = { '-latn' = ' لاتينية' , '-cyrl' = ' سيريلية' , '-arab' = ' عربية' , } for code, v in pairs(lang_table) do lang_namecode = v.name lang_codesv.name = code if v.al_name then lang_name_with_alcode = v.al_name lang_codesv.al_name = code end if v.names then for i, na in pairs( v.names ) do lang_codesna = code end end lang_namecode = v.name for i, r in pairs( v.codes ) do lang_namer = v.name if v.al_name then lang_name_with_alr = v.al_name end end end function gsubname(temp , the , code) if lang_name_with_alcode then return lang_name_with_alcode end if the and the ~= '' then s = string.gsub(temp, " ", " ال") s = "ال".. s fi = s else fi = temp end return fi end function LatnCyrl(code,al,number, returnnil) local ar_name = "" code = code:lower() number = (number or 0) +1 e = string.sub(code, -5) -- 5 from the end until the end s = string.gsub(code, e, ) d = p.getname(s , '' , number) if d and d ~= then if scriptse then ar_name = d .. scriptse end end if returnnil and returnnil ~= '' then co = '' else co = code end if ar_name "" then return co else return gsubname(ar_name , al , code) end end function p.getcode(code) s = code s = string.gsub(code, ' ', ) return lang_names end function p.get_name_from_code(code) return p.getcode(code) end function p.getname(code, al, number, returnnil) number = (number or 0) + 1 if number and number > 3 then return nil end if not code or code then return '' end code = string.gsub(code , ' ', )--:lower() if code and code~= '' then name = p.get_name_from_code(code) if name and name ~= '' then fi = gsubname(name , al , code) else fi = LatnCyrl(code,al,number, returnnil) end end return fi end function get_code_from_name(name) if lang_codesname then return lang_codesname end for ss, v in pairs(lang_table) do if (name p.getname(ss, 't') or name p.getname(ss , '')) then return ss--frame:preprocess(ss) else for q, codee in pairs( v.codes ) do if (name p.getname(codee, 't') or name p.getname(codee, '')) then return codee elseif (name p.getname(ss .. '-cyrl', 't') or name p.getname(ss .. '-cyrl', '')) then return ss .. '-cyrl' elseif (name p.getname(ss.. '-latn', 't') or name p.getname(ss.. '-latn', '')) then return ss.. '-latn' elseif (name p.getname(ss.. '-arab', 't') or name p.getname(ss.. '-arab', '')) then return ss.. '-arab' end end end end end pلغة' = function ( frame ) local na = frame.args1 if not na or na then return '' end local code = p.getname(frame.args1, frame.args2, 0, frame.args'nil') return frame:preprocess(code) end pرمز لغة' = function ( frame ) lange= frame.args1 text = frame.args2 local c = p.getname(frame.args1, 't') if lange and lange ~= '' then lange = string.gsub(lange, ' ', '') lange = lange:lower() textout = mw.text.tag('span', {lang= lange}, text) local p = 'تصنيف:مقالات تحتوي نصا ب' if lange 'ar' or lange 'ara' then cate = '' else cate = ''.. p .. (c or lange) .. '' end return textout .. cate else return '' end end pلغة' = function ( frame ) local na = frame.args1 if na and na~= '' then return get_code_from_name(na) or get_code_from_name( gsubname( na , 't' , "" ) ) else return '' end end p'قائمة' = function ( frame ) lang= require('Module:لغات/بيانات') local list = mw.html.create("table") list:addClass("wikitable sortable collapsible") local head = list:tag("tr") head:tag("th"):wikitext("رمز") head:tag("th"):wikitext("تضمين قالب") head:tag("th"):wikitext("وصلة") head:tag("th"):wikitext("اسم") head:tag("th"):wikitext("التحويلات") for code, nam in pairs(lang_table) do local temp = nam.name-- or k local row = list:tag("tr") local oo = row:tag("td") local r = row:tag("td") local th = row:tag("td") local ss = row:tag("td") local rr = row:tag("td") local rsr = ' ' local er = 'قالب:اسم آيزو 639 ' .. code ..'' local dd = "\nلغة ".. temp .."" local ooo = 'اللغة ' .. gsubname(temp, 'r' ,code ) oo:tag("span"):wikitext(er) r:tag("span"):wikitext(frame:preprocess(rsr)) th:tag("span"):wikitext(dd) ss:tag("span"):wikitext(ooo) for k,v in pairs(nam.codes ) do local cc = {} if v and v ~= '' then u = v end rr:tag("code"):wikitext(u) rr:tag("span"):wikitext(' - ') end end return list end return p